package com.fms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fms.mapper.ClientMapper;
import com.fms.entity.Client;
import com.fms.service.ClientService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
//用户模块（暂时没用）
public class ClientServiceImpl extends ServiceImpl<ClientMapper, Client> implements ClientService {

    private final ClientMapper clientMapper;
    @Override
    public List<Client> getClientList() {
        LambdaQueryWrapper<Client> query = new LambdaQueryWrapper<>();
        List<Client> clients = clientMapper.selectList(query);
        for (Client client : clients) {
            if(client.getStatus() == 0){
                client.setStatusName("普通用户");
            }else {
                client.setStatusName("VIP用户");
            }
            if(client.getGender().equals(1)){
                client.setSexuality("男");
            }else {
                client.setSexuality("女");
            }
        }
        return clients;
    }
}
